package com.example.springboot_16_rabbitmq.message;

import com.example.springboot_16_rabbitmq.pojo.User;
import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class ObjectSender {
    @Autowired
    private AmqpTemplate rabbitTemplate;

    public void send(User user)
    {
        System.out.println("发送到对象:"+user);
        rabbitTemplate.convertAndSend("hello",user);
    }
}
